package com.qfedu.mbtiapi.controller;

import com.qfedu.mbtiapi.entity.User;
import com.qfedu.mbtiapi.service.UserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 用户表(User)表控制层
 *
 * @author makejava
 * @since 2024-11-01 10:53:41
 */
@RestController
@RequestMapping("api/user")
@Tag(name = "用户模块")
public class UserController {
    /**
     * 服务对象
     */
    @Resource
    private UserService service;

    @Operation(summary = "注册")
    @PostMapping("register")
    public String register(@RequestBody User user){
        return service.register(user);
    }
    @Operation(summary = "登录")
    @GetMapping("login")
    public Integer login(String account,String password){
        return service.login(account, password);
    }
    @Operation(summary = "用户列表")
    @GetMapping("all")
    public List<User> all(){
        return service.queryAll();
    }
}